package com.bunnyhsu.service.impl;

import com.bunnyhsu.mapper.CommitterMapper;
import com.bunnyhsu.model.Committer;
import com.bunnyhsu.service.CommitterService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by xl on 2018/4/10.
 */
@Service
public class CommitterServiceImpl implements CommitterService{

    @Autowired
    private CommitterMapper committerMapper;

    @Override
    public Committer getCommitter(String id) {
        return committerMapper.selectCommitter(id);
    }

    @Override
    public void insertCommitter(String id, String image, String nickname) {
        committerMapper.insertCommitter(nickname,id,image);
    }

    @Override
    public boolean updateCommitter(String id, String image, String nickname) {
        if(committerMapper.updateCommitter(nickname,id,image) == 0)
        {
            insertCommitter(id,image,nickname);
        }
        return true;
    }

}
